package com.example.train.api.controller.v1;

import com.example.train.app.service.JobService;
import com.example.train.domain.entity.Job;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: chundong.huang@hand-china.com
 * @Date: 2023/3/25 15:40
 */
@RestController
@RequestMapping("/job")
public class JobController {

    private final JobService jobService;

    public JobController(JobService jobService) {
        this.jobService = jobService;
    }

    @GetMapping("/list")
    public ResponseEntity<?> list(@RequestParam("id") String id) {
        return ResponseEntity.ok(jobService.list(id));
    }

    @PostMapping("/update")
    public ResponseEntity<?> update(@RequestBody Job job) {
        return ResponseEntity.ok(jobService.update(job));
    }

}
